import request from '@/utils/request'

// api地址
const api = {
  page: '/store/coupon-tpls/verify/page',
  pay: '/store/scancode-pay/pay',
  check: '/store/scancode-pay/check-coupon',
  detail: '/store/coupon-tpls/detail',
  couponShops: '/store/scancode-pay/list-coupon-shops',
  cancel: '/store/coupon-tpls/cancel/verify'
}

// 账单分页查询
export const page = (param, option) => {
  return request.get(api.page, param, option)
}

// 核验
export const pay = (param, option) => {
  return request.post(api.pay, param, option)
}

// 校验
export const check = (param, option) => {
  return request.get(api.check, param, option)
}

// 券详情
export const detail = (param, option) => {
  return request.post(api.detail, param, option)
}

// 可用门店-券详情展示（只读）
export const shops = (couponTplId) => {
  return request.get(`/store/coupon-tpls/${couponTplId}/shops`, {}, { load: false })
}

// 该券的可用门店
export const getCouponShops = (param, option) => {
  return request.get(api.couponShops, param, option)
}

// 撤销核销
export const cancel = (param, option) => {
  return request.post(api.cancel, param, option)
}
